package com.bawei.play.view

import android.content.Context
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.PagerSnapHelper
import androidx.recyclerview.widget.RecyclerView

/**
 * Author: Jason Zhang
 * Date: 2024/9/23
 * Desc: 自定义LinearLayoutManager
 */
class SnapPageLayoutManager constructor(context: Context) : LinearLayoutManager(context){

    private val mSnapHelper = PagerSnapHelper()


    override fun onAttachedToWindow(view: RecyclerView?) {
        super.onAttachedToWindow(view)
        mSnapHelper.attachToRecyclerView(view) //把页面切换交给PagerSnapHelper来处理
    }

}